<?php
//声明命名空间
namespace Admin\Model;

use Frame\Libs\BaseModel;

final class NewsModel extends BaseModel{
	//私有的数据表名称
	protected $table = "news";
	public function News($where,$startpage,$pagesize)
	{
		$sql  = "select news.*,user.username,type.type_name from {$this->table} ";
		$sql .= "inner join user on news.author_id = user.id ";
		$sql .= "inner join type on news.type_id = type.id ";
		$sql .= "where {$where} ";
		$sql .= "order by news.id desc ";
		$sql .= "limit $startpage,$pagesize";
		$result = $this->pdo->fetchAll($sql);
		return $result;
	}
}